package com.ecommerce.dal.entity;
// Generated May 3, 2013 3:35:49 PM by Hibernate Tools 3.6.0

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Category generated by hbm2java
 */
@Entity
@Table(name = "category",  uniqueConstraints = @UniqueConstraint(columnNames = "CATEGORY_NAME"))
public class Category implements java.io.Serializable {

	private Long categoryId;
	private Category category;
	private String categoryName;
	private Set<Item> items = new HashSet<Item>(0);
	private Set<Category> categories = new HashSet<Category>(0);
	private Set<CategoryPhoto> categoryPhotos = new HashSet<CategoryPhoto>(0);
	private Set<Client> clients = new HashSet<Client>(0);

	public Category() {
	}

	public Category(String categoryName) {
		this.categoryName = categoryName;
	}

	public Category(Category category, String categoryName, Set<Item> items,
			Set<Category> categories, Set<CategoryPhoto> categoryPhotos,
			Set<Client> clients) {
		this.category = category;
		this.categoryName = categoryName;
		this.items = items;
		this.categories = categories;
		this.categoryPhotos = categoryPhotos;
		this.clients = clients;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "CATEGORY_ID", unique = true, nullable = false)
	public Long getCategoryId() {
		return this.categoryId;
	}

	public void setCategoryId(Long categoryId) {
		this.categoryId = categoryId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SUPERCATEGORY_ID")
	public Category getCategory() {
		return this.category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	@Column(name = "CATEGORY_NAME", unique = true, nullable = false)
	public String getCategoryName() {
		return this.categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "category")
	public Set<Item> getItems() {
		return this.items;
	}

	public void setItems(Set<Item> items) {
		this.items = items;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "category")
	public Set<Category> getCategories() {
		return this.categories;
	}

	public void setCategories(Set<Category> categories) {
		this.categories = categories;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "category")
	public Set<CategoryPhoto> getCategoryPhotos() {
		return this.categoryPhotos;
	}

	public void setCategoryPhotos(Set<CategoryPhoto> categoryPhotos) {
		this.categoryPhotos = categoryPhotos;
	}

	@ManyToMany(fetch = FetchType.LAZY, mappedBy = "categories")
	public Set<Client> getClients() {
		return this.clients;
	}

	public void setClients(Set<Client> clients) {
		this.clients = clients;
	}

}
